package lab03.test13;

import java.sql.*;

public class Test {
    public static void main(String[] args) {
        Connection connection=null;
        Statement statement=null;
        ResultSet resultSet=null;
        //表名字t_users
        String sql="insert into t_users(id,username,password) values(2,'chen','123')";
        //加载驱动程序
        try {
            Class.forName("com.mysql.jdbc.Driver");

            try {
                connection= DriverManager.getConnection(
                        "jdbc:mysql://localhost:3306/sctu?serverTimezone=UTC",
                        "root",
                        "123456"
                );
                statement=connection.createStatement();
                statement.execute(sql);



            } catch (SQLException e) {
                e.printStackTrace();
            }


        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            try {
                statement.close();
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }

        }

    }
}
